importPackage(java.io);

load("scripts/test/test.js");
load("scripts/test/lib/config.js");
load("scripts/lib/panda/jquery.js");
load("scripts/lib/panda/tmpl.js");
load("scripts/lib/panda/render.js");
load("scripts/test/lib/render/before.js");

(function(){
	var testCases = [], testCase;
	var folders = File("scripts/test/lib/render").listFiles();
	panda.each(folders, eachFolder);

	test({
		name: function() { return "Render Test"; },
		suite: function() { return testCases; }
	});

	function eachFolder(folder) {
		if (folder.file) { return; }
		var name = folder.name + "";
		testCase = { name: function() { return name; } };

		var files = folder.listFiles();
		panda.each(files, eachFile);
		testCases.push(testCase);
	}

	function eachFile(file) {
		var name = (file.name + "");
		name = name.substr(0, name.length - 3);
		var method = "test" + panda.upper(name);
		testCase[method] = function(){ execute(file); }		
	}

	function execute(file) {
		load(file);
		run();
	}
}());
